<?php
namespace app\cms\controller;

use app\common\controller\Front;

class Index extends Front
{

    public function _initialize()
    {
        parent::_initialize();
    }
    
    public function index()
    {
        $info = [];
        //分页路径
        $info['pagePath']       = DcUrl('cms/index/index',['pageNumber'=>'[PAGE]']);
        //地址栏
        $info['pageSize']       = intval(config('cms.limit_index'));
        $info['pageNumber']     = $this->site['page'];
        //SEO标签
        $info['seoTitle']       = cmsSeo(config('cms.index_title'),$this->site['page']);
        $info['seoKeywords']    = cmsSeo(config('cms.index_keywords'),$this->site['page']);
        $info['seoDescription'] = cmsSeo(config('cms.index_description'),$this->site['page']);
        //数据列表按置顶的排序
        if($info['pageSize']){
            $item = cmsSelect([
                'cache'    => true,
                'status'   => 'normal',
                'limit'    => $info['pageSize'],
                'page'     => $info['pageNumber'],
                'sort'     => 'info_order desc,info_update_time',//meta_value_num
                'order'    => 'desc',
                //'meta_key' => 'cms_top',
            ]);
            if($item){
               $this->assign($item); 
            }
        }
        //变量赋值
        $this->assign($info);
        //加载模板
        return $this->fetch();
    }
}